package com.seelyn.ddvideo.event;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

/**
 * @author ifcousing-linfeng
 * @since 2017/6/16
 */
@Component
public class SystemEventPublisher implements ApplicationContextAware {

    private ApplicationContext applicationContext;

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        this.applicationContext = applicationContext;
    }

    /**
     * 发布解析错误事件
     * @param parseErrorEvent 解析错误事件
     */
    public void publishParseError(ParseErrorEvent parseErrorEvent) {
        this.applicationContext.publishEvent(parseErrorEvent);
    }

}
